﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;

namespace Wolfut.MirageEE.Domain.Common
{
    /// <summary>
    ///  todo test ValidateIsUniqueInSameTransactionWithString(true,false) 
    [ActiveRecord("CURRENCY_CATEGORIES")]
    [Serializable]
    public class CurrencyCategory : PersistentObjectWithGuid
    {

        #region CurrencyCode
        [Property("CURRENCY_CODE")]
        [ValidateIsUniqueInSameTransactionWithString(false, "数据库已经存在相同的币别代码！")]
        [ValidateNonEmpty,ValidateLength(0,20,"币别代码超长！")]
       
        public virtual string CurrencyCode
        {
            get
            {
                return currencyCode;
            }
            set
            {
                currencyCode = value;
            }
        }

        private string currencyCode;
#endregion
        #region Rates
        [Property()]
        [ValidateRangeEx(RangeValidationType.Decimal, 0.0, int.MaxValue, "利率必须大于0！")]
        public virtual decimal Rates
        {
            get
            {
                return rates;
            }
            set
            {
                rates = value;
            }
        }

        private decimal rates;
        #endregion
        #region CurrencyName
        [Property("CURRENCY_NAME")]
        [ValidateIsUniqueInSameTransactionWithString(false, "数据库已经存在相同的币别名称！")]
     
        [ValidateNonEmpty, ValidateLength(0, 40, "币别名称超长！")]
        public virtual string CurrencyName
        {
            get
            {
                return currencyName;
            }
            set
            {
                currencyName = value;
            }
        }

        private string currencyName;
        #endregion
        #region IsRMB

        [Property("IS_RMB")]
        public virtual bool IsRMB
        {
            get
            {
                return isRMB;
            }
            set
            {
                isRMB = value;
            }
        }

        private bool isRMB;
        #endregion
        #region 逻辑删除
        private Boolean isDeleted;
        [Property("IS_DELETED")]
        public virtual Boolean IsDeleted
        {
            get
            {
                return isDeleted;
            }
            set
            {
                isDeleted = value;
            }
        }
        #endregion
    }
}
